function transform (source = {}, transform) {
  let target = { ...source };
  if (transform instanceof Function) {
    return transform(target) || {};
  } else if (transform instanceof Object) {
    for (let [name, alias] of Object.entries(transform)) {
      target[name] = target[alias];
    }
  }
  return target;
}

export default transform;
